package com.osfw.dbadminer.service.database.impl;

import com.osfw.dbadminer.entity.connect.DbaConnect;
import com.osfw.dbadminer.mapper.connect.DbaConnectMapper;
import com.osfw.dbadminer.service.database.IDbaDataFunctionService;
import com.osfw.dbadminer.service.jdbc.JdbcBaseFactory;
import com.osfw.dbadminer.service.jdbc.JdbcBaseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.SQLException;
import java.util.List;

/**
 * 数据表操作 服务层处理
 */
@Service
public class DbaDataFunctionServiceImpl implements IDbaDataFunctionService {
    @Resource
    private DbaConnectMapper connectMapper;
    

    public List<String> getAllFunctions(Long connectId, String database) throws SQLException {
        DbaConnect connect = connectMapper.selectById(connectId);
        JdbcBaseService jdbcService = JdbcBaseFactory.createAndInit(connect);
        return jdbcService.getFunctionList(database);
    }

}
